import React from 'react'
import ReactDOM from 'react-dom'

import classes from './Backdrop.module.css'


const backdropRoot = document.getElementById('backdrop-root')
const cartPayRoot = document.getElementById('cartpay-root')

const Backdrop = props => {
	return ReactDOM.createPortal(
		<div className={classes.Backdrop}>{props.children}</div>,
		props.rootLocation === 'backdrop-root' ? backdropRoot : cartPayRoot
	)
}

export default Backdrop
